<?php
	$usuario= 'root';
	$senha = 'Mudar1234&5_';
	$banco = 'dentalCremer';

	$conn = @mysql_connect('localhost',  $usuario,  $senha);
	mysql_select_db($banco,$conn);

	$query = get_query("SELECT CHARACTER_LENGTH(voucher) as 'numcaracteres', voucher FROM graficaVouchers WHERE CHARACTER_LENGTH(voucher) < 8 ORDER BY CHARACTER_LENGTH(voucher)");
	foreach ($query as $q) {
		$mysql_deletar = mysql_query("DELETE FROM graficaVouchers WHERE voucher = '". $q->voucher ."'");
	}
	
	function get_query($query){
		$res = mysql_query($query);
		$resultado = array();
		while($row = mysql_fetch_object($res)) {
			$resultado[] = $row;
		}
		mysql_free_result($res);
		return $resultado;
	}
	